/**
 * 
 */
package com.kandinfo.survey.weixin.dto;

import java.io.Serializable;

import com.tencent.common.Signature;

/**
 * @author tangqh
 * 盖DTO只允许放置不影响安全的字段，所有影响安全的数据不允许
 */
public class WxJsConfigureDto implements Serializable {
	private static final long serialVersionUID = -3466562109228894417L;

	private boolean debug = false;// 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
	private String appId;// 必填，公众号的唯一标识
	private String timestamp; // 必填，生成签名的时间戳
	private String nonceStr;// 必填，生成签名的随机串
	private String signature;// 必填，签名，见附录1
	private String url;//签名需要用到，必须和微信那边配置一致
	// 必填，需要使用的JS接口列表，所有JS接口列表见附录2
	public String[] jsApiList = new String[] { "onMenuShareTimeline", "onMenuShareAppMessage",
			"onMenuShareQQ", "onMenuShareWeibo", "startRecord", "stopRecord", "onVoiceRecordEnd", "playVoice",
			"pauseVoice", "stopVoice", "onVoicePlayEnd", "uploadVoice", "downloadVoice", "chooseImage", "previewImage",
			"uploadImage", "downloadImage", "translateVoice", "getNetworkType", "openLocation", "getLocation",
			"hideOptionMenu", " showOptionMenu", " hideMenuItems", "showMenuItems", " hideAllNonBaseMenuItem",
			" showAllNonBaseMenuItem", "  closeWindow", "  scanQRCode", "  chooseWXPay", " openProductSpecificView",
			" addCard", " chooseCard", "openCard" };

	public WxJsConfigureDto signature(String ticket) {
		setSignature(Signature.getSign4Jssdk(ticket, nonceStr, timestamp, url));
		return this;
	}
	
	public boolean getDebug() {
		return debug;
	}
	public void setDebug(boolean debug) {
		this.debug = debug;
	}
	public String getAppId() {
		return appId;
	}
	public void setAppId(String appId) {
		this.appId = appId;
	}
	public String getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(String timestamp) {
		this.timestamp = timestamp;
	}
	public String getNonceStr() {
		return nonceStr;
	}
	public void setNonceStr(String nonceStr) {
		this.nonceStr = nonceStr;
	}
	public String getSignature() {
		return signature;
	}
	public void setSignature(String signature) {
		this.signature = signature;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}

	public String[] getJsApiList() {
		return jsApiList;
	}

	public void setJsApiList(String[] jsApiList) {
		this.jsApiList = jsApiList;
	}
}
